
jQuery(document).ready(function() {

	$('#saveStatus').click(function() {
		guardaEstatus();
	});
	
//	$('#saveBranch').click(function() {
//		guardaBranch();
//	});

});

var guardaEstatus = function(){
	$.ajax({
		url : 'statusChange', // action to be perform 
		type : 'POST',
		data : {
			status : $("#valueStatusTransition").val()
		},
		dataType : 'html',
		success : function(html) {
			llamado();
			$('#contC').html(html);
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
};

var guardaBranch = function(){
	$.ajax({
		url : 'branchChange', // action to be perform 
		type : 'POST',
		data : {
			branchTransition : $("#valueBranchTransition").val()
		},
		dataType : 'html',
		success : function(html) {
			cargaGridBranch();
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
};

var llamado = function() {	
	$.ajax({
		url : 'getLog', // action to be perform
		dataType : 'html',
		success : function(html) {
			$('#log').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
 };